.message-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f5f5f5;
}

.message-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 人工客服切换区域 */
.agent-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-status {
  font-size: 12px;
  color: #f5f5f5;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
}
.agent-btn {
  border: none;
  padding: 6px 12px;
  border-radius: 14px;
  background: #ffffff;
  color: #6a5acd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: all .2s ease;
}
.agent-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.agent-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.message-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.status {
  background-color: #4caf50;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* 服务类型选择标签 */
.service-tabs {
  display: flex;
  background: white;
  padding: 16px 20px;
  gap: 20px;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #666;
}

.tab-item:hover {
  background-color: #f8f9fa;
  transform: translateY(-1px);
}

.tab-item.active {
  color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.tab-icon {
  width: 24px;
  height: 24px;
}

.tab-item span {
  font-size: 14px;
  font-weight: 500;
}

.message-list {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s ease;
}

.message-list.drag-over {
  background: rgba(102, 126, 234, 0.1);
  border: 2px dashed #667eea;
  border-radius: 12px;
  position: relative;
}

.message-list.drag-over::after {
  content: '拖拽文件到此处上传';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(102, 126, 234, 0.9);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  z-index: 10;
}

.message-item {
  display: flex;
  margin-bottom: 8px;
  align-items: flex-start;
  gap: 8px;
}

.message-item.user {
  justify-content: flex-end;
}

.message-item.service {
  justify-content: flex-start;
}

/* 头像样式 */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.user-avatar {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.service-avatar {
  background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.message-content {
  max-width: 70%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message-item.user .message-content {
  align-items: flex-end;
}

/* 文本消息样式 */
.message-text {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  max-width: 100%;
}

.message-item.user .message-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 6px;
}

.message-item.service .message-text {
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 图片消息样式 */
.message-image {
  border-radius: 12px;
  overflow: hidden;
  max-width: 200px;
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
}

.message-image:hover {
  transform: scale(1.02);
}

.message-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* 上传进度样式 */
.upload-progress {
  padding: 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  text-align: center;
  min-width: 150px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

/* 文件信息样式 */
.file-info {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 8px;
  margin-top: 8px;
  font-size: 12px;
}

/* 通用文件消息 */
.message-file {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  min-width: 220px;
}
.message-file .file-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.message-file .file-meta{
  display:flex;
  align-items:center;
  gap:8px;
  overflow:hidden;
}
.message-file .file-icon{ font-size:18px; }
.message-file .file-name{ max-width:160px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.message-file .file-size{ color:#999; font-size:12px; margin-left:6px; }
.message-file .file-download{
  padding:6px 10px;
  border-radius:10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color:#fff; text-decoration:none; font-size:12px;
}
.message-file .file-download:hover{ opacity:.9; }

.file-name {
  display: block;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.file-size {
  color: #ccc;
  font-size: 11px;
}

/* 表情消息样式 */
.message-emoji {
  font-size: 24px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 音频消息样式 */
.message-audio {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: white;
  border-radius: 18px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 280px;
  max-width: 350px;
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-icon {
  font-size: 24px;
  color: #667eea;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.audio-controls {
  flex: 1;
}

.audio-controls audio {
  width: 100%;
  height: 36px;
  border-radius: 18px;
  background: #f8f9fa;
}

.custom-audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.play-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.audio-progress {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  transition: width 0.1s ease;
}

.audio-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.audio-duration {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
}

.audio-waveform {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
}

.wave-bar {
  width: 3px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  animation: wave 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 60%; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 80%; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 80%; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 60%; animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

.audio-file-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 11px;
}

.audio-file-name {
  color: #333;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.audio-file-size {
  color: #666;
  font-size: 10px;
}

/* 视频消息样式 */
.message-video {
  border-radius: 12px;
  overflow: hidden;
  max-width: 250px;
  background: #000;
}

.message-video video {
  width: 100%;
  height: auto;
  display: block;
}

.message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.message-item.user .message-time {
  text-align: right;
}

.message-item.service .message-time {
  text-align: left;
}

/* 空消息提示样式 */
.empty-tip {
  background: #ff6b6b;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  text-align: center;
  margin: 0 20px 16px 20px;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 表情面板样式 */
.emoji-panel {
  background: white;
  border-top: 1px solid #e0e0e0;
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.emoji-item {
  font-size: 24px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.emoji-item:hover {
  background-color: #f0f0f0;
}

.emoji-tip {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-top: 12px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
}

/* 媒体选择面板样式 */
.media-panel {
  background: white;
  border-top: 1px solid #e0e0e0;
  padding: 16px;
}

.media-options {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.media-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #666;
}

.media-option:hover {
  background-color: #f8f9fa;
  transform: translateY(-2px);
}

.media-option svg {
  width: 24px;
  height: 24px;
  color: #667eea;
}

.media-option span {
  font-size: 12px;
  font-weight: 500;
}

/* 录音状态样式 */
.recording-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.recording-content {
  background: white;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.recording-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.recording-text {
  font-size: 16px;
  color: #333;
  margin-bottom: 16px;
}

.stop-recording {
  background: #ff6b6b;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.stop-recording:hover {
  background: #ff5252;
}

/* 输入区域样式 */
.message-input-area {
  background: white;
  border-top: 1px solid #e0e0e0;
  padding: 16px 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.input-container {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.media-btn,
.emoji-btn,
.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.media-btn {
  background: #f0f0f0;
  color: #666;
}

.media-btn:hover {
  background: #e0e0e0;
}

.emoji-btn {
  background: #f0f0f0;
  color: #666;
}

.emoji-btn:hover {
  background: #e0e0e0;
}

.send-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.text-input-container {
  flex: 1;
  position: relative;
}

.message-input {
  width: 100%;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  font-family: inherit;
}

.message-input:focus {
  border-color: #667eea;
}

.message-input::placeholder {
  color: #999;
}

/* 停止按钮样式 */
.stop-btn {
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background-color 0.2s ease;
}

.stop-btn:hover {
  background: #ff5252;
}

/* 滚动条样式 */
.message-list::-webkit-scrollbar,
.emoji-panel::-webkit-scrollbar {
  width: 6px;
}

.message-list::-webkit-scrollbar-track,
.emoji-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.message-list::-webkit-scrollbar-thumb,
.emoji-panel::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.message-list::-webkit-scrollbar-thumb:hover,
.emoji-panel::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .message-container {
    height: calc(100vh - 60px);
  }
  
  .message-header {
    padding: 12px 16px;
  }
  
  .service-tabs {
    padding: 12px 16px;
    gap: 16px;
  }
  
  .tab-item {
    padding: 10px 16px;
  }
  
  .tab-icon {
    width: 20px;
    height: 20px;
  }
  
  .tab-item span {
    font-size: 12px;
  }
  
  .message-list {
    padding: 16px;
  }
  
  .message-input-area {
    padding: 12px 16px;
  }
  
  .message-content {
    max-width: 75%;
  }
  
  .avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  
  .empty-tip {
    margin: 0 16px 12px 16px;
    font-size: 13px;
  }
  
  .media-options {
    gap: 16px;
  }
  
  .media-option {
    padding: 12px;
  }
  
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .message-image {
    max-width: 150px;
  }
  
  .message-video {
    max-width: 200px;
  }
  
  .message-audio {
    min-width: 250px;
    max-width: 300px;
  }
  
  .message-audio audio {
    width: 100%;
  }
  
  .audio-file-name {
    max-width: 150px;
  }
}
